package com.itany.corejava.code07_面向对象;

import java.util.Arrays;

/**
 * @author: 石小俊
 * @date: 2023年03月06日 14:08
 * @version: 1.0
 */
public class Person {
    // 成员属性
    String name;
    int age;
    String gender;
    String[] hobbies;

    // 成员方法
    public void show() {
        System.out.println(name + "今年" + age + "岁,是个" + gender + "性,兴趣爱好:" + Arrays.toString(hobbies));
    }

    public void eat() {
        System.out.println(name + "肚子饿了,要吃酸菜鱼");
    }

    public void sleep() {
        System.out.println(name + "困了,想要睡觉了");
    }

    public void isAdult() {
        if (age < 18) {
            System.out.println(name + "尚未成年,继续学习");
        } else {
            System.out.println(name + "成年,该找对象了");
        }
    }
}

class Person2 {
    public void test() {
        System.out.println("这是Person2的测试方法");
    }
}